#if !defined(__APP_DEVICE_H__)
#define __APP_DEVICE_H__

#include "app_buffer.h"
#include "pthread.h"

typedef struct
{
    char * filename;
    int fd;

    Buffer_t * up_buffer;
    Buffer_t * down_buffer;

    pthread_t read_thread;
    int is_running;

    long last_write_time;

    int (* post_read)(char * data, int len);
    int (* pre_write)(char * data, int len);
}Device_t;

Device_t *app_device_init(char *filename);

int app_device_start(void);

void app_device_destroy(void);

#endif // __APP_DEVICE_H__
